package week6;
import java.io.*;
/**
 * Created by dell on 2017/4/1.
 */
public class TestTransient {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        A a = new A(100,"Transient or not");
        System.out.println(a);
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("d://mm.txt"));
        oos.writeObject(a);
        oos.close();
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("d://mm.txt"));
        a = (A)ois.readObject();
        System.out.println(a);
    }
}
class A implements Serializable{
    int a;
    transient String b;
    public A(int a,String b){
        this.a = a;
        this.b = b;
    }
    public String toString(){
        return "a = "+a+",b = "+b;
    }
}